"==================="
"基本设置"
"==================="
set nocompatible "关闭兼容模式
source $VIMRUNTIME/mswin.vim "模仿windows快捷键
set wildmenu"按TAB键时命令行自动补齐"
set ignorecase"忽略大小写"
set number "显示行号"
set ruler"显示当前光标位置"
set autoread"文件在Vim之外修改过，自动重新读入"
set autowrite"设置自动保存内容"
set autochdir"当前目录随着被编辑文件的改变而改变"
set nocp "使用vim而非vi"
set mouse=a"开启鼠标支持"
map 9 $"通过9跳转到行末尾,0默认跳转到行首"
filetype on "启动文件类型检查"
filetype plugin on "根据侦测到的不同类型加载对应的插件"
set cursorcolumn	"高亮行
set cursorline		"高亮列
set laststatus=2  " 总是显示状态行
set showcmd " 状态栏显示目前所执行的指令
if has("gui_running")
	set guioptions=mr "只显示菜单和右侧滚动条"
	language message zh_CN.UTF-8
endif
set visualbell"禁止响铃"
set vb t_vb=				"关闭声音
au GuiEnter * set t_vb=		"关闭声音后，vim会用闪屏提示错误，多按一次esc也会闪


"======================"
"编码相关
"======================"
if has("multi_byte")
	set fileencodings=utf-8,ucs-bom,cp936,cp1250,big5,euc-jp,euc-kr,latin1
else
	echoerr "Sorry, this version of (g)vim was not compiled with multi_byte"
endif
"gvim内部编码
set encoding=utf-8
"当前编辑的文件编码
set fileencoding=utf-8
"解决consle输出乱码
language messages zh_CN.utf-8
"解决菜单乱码
source $VIMRUNTIME/delmenu.vim
source $VIMRUNTIME/menu.vim
"设置终端编码为gvim内部编码encoding
let &termencoding=&encoding
"防止特殊符号无法正常显示
set ambiwidth=double

"========================"
"编辑相关"
"========================"
"快捷输入日期"
map <silent>  \d a<C-R>=strftime("%Y/%m/%d %A")<CR>  
"快捷输入时间"
map <silent>  \t a<C-R>=strftime("%Y/%m/%d %H:%M:%S")<CR>
"去空行  
nnoremap <F2> :g/^\s*$/d<CR> 
map <silent>   ,d :split ~/Dropbox/Doc/ <CR> 
iab --l  -------------------- 
iab ==l  ====================

"============="
"设置缩进"
"============="
set cindent "c/c++自动缩进"
set smartindent
set autoindent"参考上一行的缩进方式进行自动缩进"
filetype indent on "根据文件类型进行缩进"
set softtabstop=4 "4 character as a tab"
set shiftwidth=4
set smarttab "按一次backspace就删除4个空格

"=========================="
"不要交换文件和备份文件，减少冲突"
"=========================="
set noswapfile
set nobackup
set nowritebackup

"================="
"当前文件内搜索选项"
"================="
set hlsearch "开启搜索结果的高亮显示"
set incsearch "边输入边搜索(实时搜索)"

"============="
"查找和替换文本"
"============="
nmap ;s :%s/\<<C-R>=expand("<cword>")<CR>\>/
nmap ;g :vimgrep <C-R>=expand("<cword>")<CR>

"==================="
"程序开发相关的设置"
"==================="
"注释：选中文本后，输入;c即可注释，输入;u 即可取消注释"
"编译和运行程序的快捷键"
"源文件和头文件之间快速切换"
"其他"
syn on "开启语法高亮功能"
set pastetoggle=<F11> "F11来支持切换paste和nopaste状态。"

"==================="
"vundle设置"
"==================="
source $HOME/vimfiles/vundle.vim